home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 10 / AACD 10.iso / AACD / Games / MAME / src / drivers / offtwall.c < prev    next >
C/C++ Source or Header  |  2000-05-06  |  17KB  |  569 lines

  1. /***************************************************************************
  2.  
  3.     Off the Wall
  4.  
  5.     driver by Aaron Giles
  6.  
  7. ****************************************************************************/
  8.  
  9.  
  10. #include "driver.h"
  11. #include "sound/fm.h"
  12. #include "machine/atarigen.h"
  13. #include "sndhrdw/atarijsa.h"
  14. #include "vidhrdw/generic.h"
  15.  
  16.  
  17. WRITE_HANDLER( offtwall_playfieldram_w );
  18. WRITE_HANDLER( offtwall_video_control_w );
  19.  
  20. int offtwall_vh_start(void);
  21. void offtwall_vh_stop(void);
  22. void offtwall_vh_screenrefresh(struct osd_bitmap *bitmap,int full_refresh);
  23.  
  24. void offtwall_scanline_update(int scanline);
  25.  
  26.  
  27.  
  28. /*************************************
  29.  *
  30.  *    Interrupt handling
  31.  *
  32.  *************************************/
  33.  
  34. static void update_interrupts(void)
  35. {
  36.     int newstate = 0;
  37.  
  38.     if (atarigen_scanline_int_state)
  39.         newstate = 4;
  40.     if (atarigen_sound_int_state)
  41.         newstate = 6;
  42.  
  43.     if (newstate)
  44.         cpu_set_irq_line(0, newstate, ASSERT_LINE);
  45.     else
  46.         cpu_set_irq_line(0, 7, CLEAR_LINE);
  47. }
  48.  
  49.  
  50.  
  51. /*************************************
  52.  *
  53.  *    Initialization
  54.  *
  55.  *************************************/
  56.  
  57. static void init_machine(void)
  58. {
  59.     atarigen_eeprom_reset();
  60.     atarigen_video_control_reset();
  61.     atarigen_interrupt_reset(update_interrupts);
  62.     atarigen_scanline_timer_reset(offtwall_scanline_update, 8);
  63.     atarijsa_reset();
  64. }
  65.  
  66.  
  67.  
  68. /*************************************
  69.  *
  70.  *    I/O handling
  71.  *
  72.  *************************************/
  73.  
  74. static READ_HANDLER( special_port3_r )
  75. {
  76.     int result = input_port_3_r(offset);
  77.     if (atarigen_cpu_to_sound_ready) result ^= 0x0020;
  78.     return result;
  79. }
  80.  
  81.  
  82. static WRITE_HANDLER( io_latch_w )
  83. {
  84.     /* lower byte */
  85.     if (!(data & 0x00ff0000))
  86.     {
  87.         /* bit 4 resets the sound CPU */
  88.         cpu_set_reset_line(1, (data & 0x10) ? CLEAR_LINE : ASSERT_LINE);
  89.         if (!(data & 0x10)) atarijsa_reset();
  90.     }
  91.  
  92.     logerror("sound control = %04X\n", data);
  93. }
  94.  
  95.  
  96.  
  97. /*************************************
  98.  *
  99.  *    Son-of-slapstic workarounds
  100.  *
  101.  *************************************/
  102.  
  103.  
  104. /*-------------------------------------------------------------------------
  105.  
  106.     Bankswitching
  107.  
  108.     Like the slapstic, the SoS bankswitches memory using A13 and A14.
  109.     Unlike the slapstic, the exact addresses to trigger the bankswitch
  110.     are unknown.
  111.  
  112.     Fortunately, Off the Wall uses a common routine for the important
  113.     bankswitching. The playfield data is stored in the banked area of
  114.     ROM, and by comparing the playfields to a real system, a mechanism
  115.     to bankswitch at the appropriate time was discovered. Fortunately,
  116.     it's really basic.
  117.  
  118.     OtW looks up the address to read playfield data from a table which
  119.     is 58 words long. Word 0 assumes the bank is 0, word 1 assumes the
  120.     bank is 1, etc. So we just trigger off of the table read and cause
  121.     the bank to switch then.
  122.  
  123.     In addition, there is code which checksums longs from $40000 down to
  124.     $3e000. The code wants that checksum to be $aaaa5555, but there is
  125.     no obvious way for this to happen. To work around this, we watch for
  126.     the final read from $3e000 and tweak the value such that the checksum
  127.     will come out the $aaaa5555 magically.
  128.  
  129. -------------------------------------------------------------------------*/
  130.  
  131. static UINT8 *bankswitch_base;
  132. static UINT8 *bankrom_base;
  133. static UINT32 bank_offset;
  134.  
  135. static READ_HANDLER( bankswitch_r )
  136. {
  137.     /* this is the table lookup; the bank is determined by the address that was requested */
  138.     bank_offset = ((offset / 2) & 3) * 0x2000;
  139.     logerror("Bankswitch index %d -> %04X\n", offset, bank_offset);
  140.  
  141.     return READ_WORD(&bankswitch_base[offset]);
  142. }
  143.  
  144. static READ_HANDLER( bankrom_r )
  145. {
  146.     /* this is the banked ROM read */
  147.     logerror("%06X: %04X\n", cpu_getpreviouspc(), offset);
  148.  
  149.     /* if the values are $3e000 or $3e002 are being read by code just below the
  150.         ROM bank area, we need to return the correct value to give the proper checksum */
  151.     if ((offset == 0x6000 || offset == 0x6002) && cpu_getpreviouspc() > 0x37000)
  152.     {
  153.         unsigned int checksum = cpu_readmem24bew_dword(0x3fd210);
  154.         unsigned int us = 0xaaaa5555 - checksum;
  155.         if (offset == 0x6002)
  156.             return us & 0xffff;
  157.         else
  158.             return us >> 16;
  159.     }
  160.  
  161.     return READ_WORD(&bankrom_base[(bank_offset + offset) & 0x7fff]);
  162. }
  163.  
  164.  
  165. /*-------------------------------------------------------------------------
  166.  
  167.     Sprite Cache
  168.  
  169.     Somewhere in the code, if all the hardware tests are met properly,
  170.     some additional dummy sprites are added to the sprite cache before
  171.     they are copied to sprite RAM. The sprite RAM copy routine computes
  172.     the total width of all sprites as they are copied and if the total
  173.     width is less than or equal to 38, it adds a "HARDWARE ERROR" sprite
  174.     to the end.
  175.  
  176.     Here we detect the read of the sprite count from within the copy
  177.     routine, and add some dummy sprites to the cache ourself if there
  178.     isn't enough total width.
  179.  
  180. -------------------------------------------------------------------------*/
  181.  
  182. static UINT8 *spritecache_count;
  183.  
  184. static READ_HANDLER( spritecache_count_r )
  185. {
  186.     int prevpc = cpu_getpreviouspc();
  187.  
  188.     /* if this read is coming from $99f8 or $9992, it's in the sprite copy loop */
  189.     if (prevpc == 0x99f8 || prevpc == 0x9992)
  190.     {
  191.         UINT16 *data = (UINT16 *)&spritecache_count[-0x200];
  192.         int oldword = READ_WORD(&spritecache_count[0]);
  193.         int count = oldword >> 8;
  194.         int i, width = 0;
  195.  
  196.         /* compute the current total width */
  197.         for (i = 0; i < count; i++)
  198.             width += 1 + ((data[i * 4 + 1] >> 4) & 7);
  199.  
  200.         /* if we're less than 39, keep adding dummy sprites until we hit it */
  201.         if (width <= 38)
  202.         {
  203.             while (width <= 38)
  204.             {
  205.                 data[count * 4 + 0] = (42 * 8) << 7;
  206.                 data[count * 4 + 1] = ((30 * 8) << 7) | (7 << 4);
  207.                 data[count * 4 + 2] = 0;
  208.                 width += 8;
  209.                 count++;
  210.             }
  211.  
  212.             /* update the final count in memory */
  213.             WRITE_WORD(&spritecache_count[0], (count << 8) | (oldword & 0xff));
  214.         }
  215.     }
  216.  
  217.     /* and then read the data */
  218.     return READ_WORD(&spritecache_count[offset]);
  219. }
  220.  
  221.  
  222. /*-------------------------------------------------------------------------
  223.  
  224.     Unknown Verify
  225.  
  226.     In several places, the value 1 is stored to the byte at $3fdf1e. A
  227.     fairly complex subroutine is called, and then $3fdf1e is checked to
  228.     see if it was set to zero. If it was, "HARDWARE ERROR" is displayed.
  229.  
  230.     To avoid this, we just return 1 when this value is read within the
  231.     range of PCs where it is tested.
  232.  
  233. -------------------------------------------------------------------------*/
  234.  
  235. static UINT8 *unknown_verify_base;
  236.  
  237. static READ_HANDLER( unknown_verify_r )
  238. {
  239.     int prevpc = cpu_getpreviouspc();
  240.     if (prevpc < 0x5c5e || prevpc > 0xc432)
  241.         return READ_WORD(&unknown_verify_base[offset]);
  242.     else
  243.         return READ_WORD(&unknown_verify_base[offset]) | 0x100;
  244. }
  245.  
  246.  
  247.  
  248. /*************************************
  249.  *
  250.  *    Main CPU memory handlers
  251.  *
  252.  *************************************/
  253.  
  254. static struct MemoryReadAddress readmem[] =
  255. {
  256.     { 0x000000, 0x037fff, MRA_ROM },
  257.     { 0x038000, 0x03ffff, bankrom_r },
  258.     { 0x120000, 0x120fff, atarigen_eeprom_r },
  259.     { 0x260000, 0x260001, input_port_0_r },
  260.     { 0x260002, 0x260003, input_port_1_r },
  261.     { 0x260010, 0x260011, special_port3_r },
  262.     { 0x260012, 0x260013, input_port_4_r },
  263.     { 0x260020, 0x260021, input_port_5_r },
  264.     { 0x260022, 0x260023, input_port_6_r },
  265.     { 0x260024, 0x260025, input_port_7_r },
  266.     { 0x260030, 0x260031, atarigen_sound_r },
  267.     { 0x3e0000, 0x3e0fff, MRA_BANK1 },
  268.     { 0x3effc0, 0x3effff, atarigen_video_control_r },
  269.     { 0x3f4000, 0x3f7fff, MRA_BANK3 },
  270.     { 0x3f8000, 0x3fcfff, MRA_BANK4 },
  271.     { 0x3fd000, 0x3fd3ff, MRA_BANK5 },
  272.     { 0x3fd400, 0x3fffff, MRA_BANK6 },
  273.     { -1 }  /* end of table */
  274. };
  275.  
  276.  
  277. static struct MemoryWriteAddress writemem[] =
  278. {
  279.     { 0x000000, 0x037fff, MWA_ROM },
  280.     { 0x038000, 0x03ffff, MWA_ROM, &bankrom_base },
  281.     { 0x120000, 0x120fff, atarigen_eeprom_w, &atarigen_eeprom, &atarigen_eeprom_size },
  282.     { 0x260040, 0x260041, atarigen_sound_w },
  283.     { 0x260050, 0x260051, io_latch_w },
  284.     { 0x260060, 0x260061, atarigen_eeprom_enable_w },
  285.     { 0x2a0000, 0x2a0001, watchdog_reset_w },
  286.     { 0x3e0000, 0x3e0fff, atarigen_666_paletteram_w, &paletteram },
  287.     { 0x3effc0, 0x3effff, atarigen_video_control_w, &atarigen_video_control_data },
  288.     { 0x3f4000, 0x3f7fff, offtwall_playfieldram_w, &atarigen_playfieldram, &atarigen_playfieldram_size },
  289.     { 0x3f8000, 0x3fcfff, MWA_BANK4 },
  290.     { 0x3fd000, 0x3fd3ff, MWA_BANK5, &atarigen_spriteram },
  291.     { 0x3fd400, 0x3fffff, MWA_BANK6 },
  292.     { -1 }  /* end of table */
  293. };
  294.  
  295.  
  296.  
  297. /*************************************
  298.  *
  299.  *    Port definitions
  300.  *
  301.  *************************************/
  302.  
  303. INPUT_PORTS_START( offtwall )
  304.     PORT_START    /* 260000 */
  305.     PORT_BIT(  0x0001, IP_ACTIVE_LOW, IPT_BUTTON4 | IPF_PLAYER2 )
  306.     PORT_BIT(  0x0002, IP_ACTIVE_LOW, IPT_START2 )
  307.     PORT_BIT(  0x0002, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_PLAYER2 )
  308.     PORT_BIT(  0x0004, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_PLAYER2 )
  309.     PORT_BIT(  0x0008, IP_ACTIVE_LOW, IPT_BUTTON3 | IPF_PLAYER2 )
  310.     PORT_BIT(  0x0010, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_PLAYER2 )
  311.     PORT_BIT(  0x0020, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT | IPF_PLAYER2 )
  312.     PORT_BIT(  0x0040, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN | IPF_PLAYER2 )
  313.     PORT_BIT(  0x0080, IP_ACTIVE_LOW, IPT_JOYSTICK_UP | IPF_PLAYER2 )
  314.     PORT_BIT(  0x0100, IP_ACTIVE_LOW, IPT_BUTTON4 | IPF_PLAYER1 )
  315.     PORT_BIT(  0x0200, IP_ACTIVE_LOW, IPT_START1 )
  316.     PORT_BIT(  0x0200, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_PLAYER1 )
  317.     PORT_BIT(  0x0400, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_PLAYER1 )
  318.     PORT_BIT(  0x0800, IP_ACTIVE_LOW, IPT_BUTTON3 | IPF_PLAYER1 )
  319.     PORT_BIT(  0x1000, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_PLAYER1 )
  320.     PORT_BIT(  0x2000, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT | IPF_PLAYER1 )
  321.     PORT_BIT(  0x4000, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN | IPF_PLAYER1 )
  322.     PORT_BIT(  0x8000, IP_ACTIVE_LOW, IPT_JOYSTICK_UP | IPF_PLAYER1 )
  323.  
  324.     PORT_START    /* 260002 */
  325.     PORT_BIT(  0x00ff, IP_ACTIVE_LOW, IPT_UNUSED )
  326.     PORT_BIT(  0x0100, IP_ACTIVE_LOW, IPT_BUTTON4 | IPF_PLAYER3 )
  327.     PORT_BIT(  0x0200, IP_ACTIVE_LOW, IPT_START3 )
  328.     PORT_BIT(  0x0200, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_PLAYER3 )
  329.     PORT_BIT(  0x0400, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_PLAYER3 )
  330.     PORT_BIT(  0x0800, IP_ACTIVE_LOW, IPT_BUTTON3 | IPF_PLAYER3 )
  331.     PORT_BIT(  0x1000, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_PLAYER3 )
  332.     PORT_BIT(  0x2000, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT | IPF_PLAYER3 )
  333.     PORT_BIT(  0x4000, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN | IPF_PLAYER3 )
  334.     PORT_BIT(  0x8000, IP_ACTIVE_LOW, IPT_JOYSTICK_UP | IPF_PLAYER3 )
  335.  
  336.     JSA_III_PORT    /* audio board port */
  337.  
  338.     PORT_START    /* 260010 */
  339.     PORT_BIT(  0x0001, IP_ACTIVE_LOW, IPT_UNUSED )
  340.     PORT_DIPNAME( 0x0002, 0x0000, "Controls" )
  341.     PORT_DIPSETTING(      0x0000, "Whirly-gigs" )    /* this is official Atari terminology! */
  342.     PORT_DIPSETTING(      0x0002, "Joysticks" )
  343.     PORT_BIT(  0x0004, IP_ACTIVE_LOW, IPT_UNUSED )    /* tested at a454 */
  344.     PORT_BIT(  0x0008, IP_ACTIVE_LOW, IPT_UNUSED )    /* tested at a466 */
  345.     PORT_BIT(  0x0010, IP_ACTIVE_LOW, IPT_UNUSED )
  346.     PORT_BIT(  0x0020, IP_ACTIVE_LOW, IPT_UNUSED )    /* tested before writing to 260040 */
  347.     PORT_SERVICE( 0x0040, IP_ACTIVE_LOW )
  348.     PORT_BIT(  0x0080, IP_ACTIVE_LOW, IPT_VBLANK )
  349.     PORT_BIT(  0xff00, IP_ACTIVE_LOW, IPT_UNUSED )
  350.  
  351.     PORT_START    /* 260012 */
  352.     PORT_BIT(  0xffff, IP_ACTIVE_LOW, IPT_UNUSED )
  353.  
  354.     PORT_START    /* 260020 */
  355.     PORT_ANALOG( 0xff, 0, IPT_DIAL_V | IPF_PLAYER1, 50, 10, 0, 0 )
  356.     PORT_BIT( 0xff00, IP_ACTIVE_LOW, IPT_UNUSED )
  357.  
  358.     PORT_START    /* 260022 */
  359.     PORT_ANALOG( 0xff, 0, IPT_DIAL | IPF_PLAYER2, 50, 10, 0, 0 )
  360.     PORT_BIT( 0xff00, IP_ACTIVE_LOW, IPT_UNUSED )
  361.  
  362.     PORT_START    /* 260024 */
  363.     PORT_ANALOG( 0xff, 0, IPT_DIAL_V | IPF_PLAYER3 | IPF_REVERSE, 50, 10, 0, 0 )
  364.     PORT_BIT( 0xff00, IP_ACTIVE_LOW, IPT_UNUSED )
  365. INPUT_PORTS_END
  366.  
  367.  
  368.  
  369. /*************************************
  370.  *
  371.  *    Graphics definitions
  372.  *
  373.  *************************************/
  374.  
  375. static struct GfxLayout pfmolayout =
  376. {
  377.     8,8,    /* 8*8 sprites */
  378.     24576,    /* 8192 of them */
  379.     4,        /* 4 bits per pixel */
  380.     { 0+0x60000*8, 4+0x60000*8, 0, 4 },
  381.     { 0, 1, 2, 3, 8, 9, 10, 11 },
  382.     { 0*8, 2*8, 4*8, 6*8, 8*8, 10*8, 12*8, 14*8 },
  383.     16*8    /* every sprite takes 16 consecutive bytes */
  384. };
  385.  
  386.  
  387. static struct GfxDecodeInfo gfxdecodeinfo[] =
  388. {
  389.     { REGION_GFX1, 0, &pfmolayout,  256, 32 },        /* sprites & playfield */
  390.     { -1 } /* end of array */
  391. };
  392.  
  393.  
  394.  
  395. /*************************************
  396.  *
  397.  *    Machine driver
  398.  *
  399.  *************************************/
  400.  
  401. static struct MachineDriver machine_driver_offtwall =
  402. {
  403.     /* basic machine hardware */
  404.     {
  405.         {
  406.             CPU_M68000,
  407.             ATARI_CLOCK_14MHz/2,
  408.             readmem,writemem,0,0,
  409.             ignore_interrupt,1
  410.         },
  411.         JSA_III_CPU
  412.     },
  413.     60, DEFAULT_REAL_60HZ_VBLANK_DURATION,    /* frames per second, vblank duration */
  414.     1,
  415.     init_machine,
  416.  
  417.     /* video hardware */
  418.     42*8, 30*8, { 0*8, 42*8-1, 0*8, 30*8-1 },
  419.     gfxdecodeinfo,
  420.     2048, 2048,
  421.     0,
  422.  
  423.     VIDEO_TYPE_RASTER | VIDEO_MODIFIES_PALETTE | VIDEO_UPDATE_BEFORE_VBLANK | VIDEO_SUPPORTS_DIRTY,
  424.     0,
  425.     offtwall_vh_start,
  426.     offtwall_vh_stop,
  427.     offtwall_vh_screenrefresh,
  428.  
  429.     /* sound hardware */
  430.     JSA_III_MONO_NO_SPEECH,
  431.  
  432.     atarigen_nvram_handler
  433. };
  434.  
  435.  
  436.  
  437. /*************************************
  438.  *
  439.  *    ROM decoding
  440.  *
  441.  *************************************/
  442.  
  443. static void rom_decode(void)
  444. {
  445.     int i;
  446.  
  447.     for (i = 0; i < memory_region_length(REGION_GFX1); i++)
  448.         memory_region(REGION_GFX1)[i] ^= 0xff;
  449. }
  450.  
  451.  
  452.  
  453. /*************************************
  454.  *
  455.  *    ROM definition(s)
  456.  *
  457.  *************************************/
  458.  
  459. ROM_START( offtwall )
  460.     ROM_REGION( 0x40000, REGION_CPU1 )    /* 4*64k for 68000 code */
  461.     ROM_LOAD_EVEN( "otw2012.bin", 0x00000, 0x20000, 0xd08d81eb )
  462.     ROM_LOAD_ODD ( "otw2013.bin", 0x00000, 0x20000, 0x61c2553d )
  463.  
  464.     ROM_REGION( 0x14000, REGION_CPU2 )    /* 64k for 6502 code */
  465.     ROM_LOAD( "otw1020.bin", 0x10000, 0x4000, 0x488112a5 )
  466.     ROM_CONTINUE(            0x04000, 0xc000 )
  467.  
  468.     ROM_REGION( 0xc0000, REGION_GFX1 | REGIONFLAG_DISPOSE )
  469.     ROM_LOAD( "otw1014.bin", 0x000000, 0x20000, 0x4d64507e )
  470.     ROM_LOAD( "otw1016.bin", 0x020000, 0x20000, 0xf5454f3a )
  471.     ROM_LOAD( "otw1018.bin", 0x040000, 0x20000, 0x17864231 )
  472.     ROM_LOAD( "otw1015.bin", 0x060000, 0x20000, 0x271f7856 )
  473.     ROM_LOAD( "otw1017.bin", 0x080000, 0x20000, 0x7f7f8012 )
  474.     ROM_LOAD( "otw1019.bin", 0x0a0000, 0x20000, 0x9efe511b )
  475. ROM_END
  476.  
  477.  
  478. ROM_START( offtwalc )
  479.     ROM_REGION( 0x40000, REGION_CPU1 )    /* 4*64k for 68000 code */
  480.     ROM_LOAD_EVEN( "090-2612.rom", 0x00000, 0x20000, 0xfc891a3f )
  481.     ROM_LOAD_ODD ( "090-2613.rom", 0x00000, 0x20000, 0x805d79d4 )
  482.  
  483.     ROM_REGION( 0x14000, REGION_CPU2 )    /* 64k for 6502 code */
  484.     ROM_LOAD( "otw1020.bin", 0x10000, 0x4000, 0x488112a5 )
  485.     ROM_CONTINUE(            0x04000, 0xc000 )
  486.  
  487.     ROM_REGION( 0xc0000, REGION_GFX1 | REGIONFLAG_DISPOSE )
  488.     ROM_LOAD( "090-1614.rom", 0x000000, 0x20000, 0x307ed447 )
  489.     ROM_LOAD( "090-1616.rom", 0x020000, 0x20000, 0xa5bd3d9b )
  490.     ROM_LOAD( "090-1618.rom", 0x040000, 0x20000, 0xc7d9df5d )
  491.     ROM_LOAD( "090-1615.rom", 0x060000, 0x20000, 0xac3642c7 )
  492.     ROM_LOAD( "090-1617.rom", 0x080000, 0x20000, 0x15208a89 )
  493.     ROM_LOAD( "090-1619.rom", 0x0a0000, 0x20000, 0x8a5d79b3 )
  494. ROM_END
  495.  
  496.  
  497.  
  498. /*************************************
  499.  *
  500.  *    Driver initialization
  501.  *
  502.  *************************************/
  503.  
  504. static const UINT16 default_eeprom[] =
  505. {
  506.     0x0001,0x011A,0x012A,0x0146,0x0100,0x0168,0x0300,0x011E,
  507.     0x0700,0x0122,0x0600,0x0120,0x0400,0x0102,0x0300,0x017E,
  508.     0x0200,0x0128,0x0104,0x0100,0x014E,0x0100,0x013E,0x0122,
  509.     0x011A,0x012A,0x0146,0x0100,0x0168,0x0300,0x011E,0x0700,
  510.     0x0122,0x0600,0x0120,0x0400,0x0102,0x0300,0x017E,0x0200,
  511.     0x0128,0x0104,0x0100,0x014E,0x0100,0x013E,0x0122,0x1A00,
  512.     0x0154,0x0125,0x01DC,0x0100,0x0192,0x0105,0x01DC,0x0181,
  513.     0x012E,0x0106,0x0100,0x0105,0x0179,0x0132,0x0101,0x0100,
  514.     0x01D3,0x0105,0x0116,0x0127,0x0134,0x0100,0x0104,0x01B0,
  515.     0x0165,0x0102,0x1600,0x0000
  516. };
  517.  
  518.  
  519. static void init_offtwall(void)
  520. {
  521.     atarigen_eeprom_default = default_eeprom;
  522.  
  523.     atarijsa_init(1, 2, 3, 0x0040);
  524.  
  525.     /* speed up the 6502 */
  526.     atarigen_init_6502_speedup(1, 0x41dd, 0x41f5);
  527.  
  528.     /* install son-of-slapstic workarounds */
  529.     spritecache_count = install_mem_read_handler(0, 0x3fde42, 0x3fde43, spritecache_count_r);
  530.     bankswitch_base = install_mem_read_handler(0, 0x037ec2, 0x037f39, bankswitch_r);
  531.     unknown_verify_base = install_mem_read_handler(0, 0x3fdf1e, 0x3fdf1f, unknown_verify_r);
  532.  
  533.     /* display messages */
  534.     atarigen_show_sound_message();
  535.  
  536.     rom_decode();
  537. }
  538.  
  539.  
  540. static void init_offtwalc(void)
  541. {
  542.     atarigen_eeprom_default = default_eeprom;
  543.  
  544.     atarijsa_init(1, 2, 3, 0x0040);
  545.  
  546.     /* speed up the 6502 */
  547.     atarigen_init_6502_speedup(1, 0x41dd, 0x41f5);
  548.  
  549.     /* install son-of-slapstic workarounds */
  550.     spritecache_count = install_mem_read_handler(0, 0x3fde42, 0x3fde43, spritecache_count_r);
  551.     bankswitch_base = install_mem_read_handler(0, 0x037eca, 0x037f43, bankswitch_r);
  552.     unknown_verify_base = install_mem_read_handler(0, 0x3fdf24, 0x3fdf25, unknown_verify_r);
  553.  
  554.     /* display messages */
  555.     atarigen_show_sound_message();
  556.  
  557.     rom_decode();
  558. }
  559.  
  560.  
  561. /*************************************
  562.  *
  563.  *    Game driver(s)
  564.  *
  565.  *************************************/
  566.  
  567. GAME( 1991, offtwall, 0,        offtwall, offtwall, offtwall, ROT0, "Atari Games", "Off the Wall (2/3-player upright)" )
  568. GAME( 1991, offtwalc, offtwall, offtwall, offtwall, offtwalc, ROT0, "Atari Games", "Off the Wall (2-player cocktail)" )
  569.